home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Dr. Windows 3
/
dr win3.zip
/
dr win3
/
PROGRAMR
/
JORF21_2.ZIP
/
MAILLIST.J
< prev
next >
Wrap
Text File
|
1993-07-05
|
16KB
|
430 lines
Class:Contact | Class definition for a Contact structure
Index:FullName | Full name
Index:Company | Company
Index:WorkPhone | Work Phone
Index:LastName | Last Name
Index:ZipCode | Zip Code
Addr1 | Address
Addr2
Addr3
HomePhone | Home Phone
WorkPhone
FaxPhone
Birthday
Anniversary
Dear
Comment
Notes | Notepad
Type
MailList:Start | Little Mail List Program
New (Contact:Con) | Create Contact Structure
Jorf:File ("CONTACT.JCM",Here) | Set Database File to CONTACT.JCM
Event:Add ("MailKey","Key",Here) | Set MailKey as a keystroke handler
Mem:Ptr->IndexName = "FullName" | Index Name
| The main screen with menu options
Win:Add ("Josephine's Mail List Manager", 2, 2, 22, 78, Here)
Menu:"&File"
Menu:"&About " Action:"MailList:About"
Menu:
Menu:"&Rebuild ", Action:"Jorf:Rebuild"
Menu:
Menu:"E&xit Alt-X", Action:"Kbd:Put('Esc_Key')"
Menu:"&Edit"
Menu:"&Add Alt-A", Action:"MailList:Add(Con)" HotKey:"Alt_A_Key"
Menu:"&Change Alt-C", Action:"MailList:Change(Con)"
Menu:"&Delete Alt-D", Action:"MailList:Delete(Con)" HotKey:"Alt_D_Key"
Menu:"&Search",
Menu:"&Name ", Action:"MailList:KeySearch (Con, 'FullName' )
Menu:"&Company ", Action:"MailList:KeySearch (Con, 'Company' )
Menu:"&Last Name ", Action:"MailList:KeySearch (Con, 'LastName' )
Menu:"&Phone ", Action:"MailList:KeySearch (Con, 'WorkPhone')
Menu:"&Zip ", Action:"MailList:KeySearch (Con, 'ZipCode' )
Menu:"&Reports"
Menu:"&Mail List ", Action:"MailList:List()"
Menu:"&This Contact ", Action:"MailList:PrintData(Con)"
Menu:"&Lotsa Labels ", Action:"MailList:ContinLabels(Con,'All')"
Menu:"&One Label", Action:"MailList:ContinLabels(Con,'One')"
InpBefore:"MailList:Lock(Con)"
Group:"&Browse List", Row:1 Col:41, Len:6, Wid:36
List:""
Field:"Con"
Next:"MailList:NextRecord(Con,'Next')"
Prev:"MailList:NextRecord(Con,'Prev')"
Show:"MailList:Show(Con)"
Before:"MailList:Write()"
Display:"(Mem:Ptr->Locked==Null)"
Group:"&Contact Name and Address", Row:1, Col:1, Wid:38, Len:6
Input:"Name ", Wid:30, Field:"Con->FullName"
After:"MailList:SplitName(Con)"
Input:"Company", Wid:30, Field:"Con->Company"
Input:"Address", Wid:30, Field:"Con->Addr1"
Input:" ", Wid:30, Field:"Con->Addr2"
Input:" ", Wid:30, Field:"Con->Addr3"
After:"MailList:ZipCode(Con)"
Group:"Mail List Fields"
Row:9 Col:1 Len:11 Wid:76
Input:"&Work Phone" Field:"Con->WorkPhone"
Row:10 Col:2 Wid:20
Input:"&Home Phone" Field:"Con->Homephone"
Row:11 Col:2 Wid:20
Input:"Fax &Phone " Field:"Con->FaxPhone"
Row:12 Col:2 Wid:20
Input:"Birthda&y " Field:"Con->BirthDay"
Row:13 Col:2 Wid:20
Input:"C&omment " Field:"Con->Comment"
Row:15 Col:2 Wid:50
Input:"&Last Name " Field:"Con->LastName"
Row:10 Col:35 Wid:14
Input:"Dear " Field:"Con->Dear"
Row:11 Col:35 Wid:14
Input:"Zip Code " Field:"Con->Zipcode"
Row:12 Col:35 Wid:14
Radio:"Fr&iend"
Check:"Con->Type=='Friend'"
Action:"Con->Type='Friend'"
UnAction:"Con->Type= Null"
Row:10 Col:62
Radio:"Fa&mily"
Check:"Con->Type=='Family'"
Action:"Con->Type='Family'"
UnAction:"Con->Type= Null"
Row:11 Col:62
Radio:"Clien&t"
Check:"Con->Type=='Client'"
Action:"Con->Type='Client'"
UnAction:"Con->Type= Null"
Row:12 Col:62
Radio:"&Vendor"
Check:"Con->Type=='Vendor'"
Action:"Con->Type='Vendor'"
UnAction:"Con->Type= Null"
Row:13 Col:62
HLine:"&Notes"
Row:16 Col:2 Len:1 Wid:76
Text:"" Field:"Con->Notes"
Row:17 Col:2 Len:4 Wid:76
Return (Ok) | That is all, Folks!
MailList:About
Msg:Add ("The JORF Mail List Manager", "Ok")
The JORF MailList Manager Version 1.0 December 22, 1992
Copyright (C) 1992 by Wayland Bruns, All Rights Reserved
This program is a small version of the CONTACT.J contact manager. &
It features a name/address/phone number file, and limited &
label printing. It does not support multiple files, filters &
and mail merge capability all found in CONTACT.J.
Use this program as a base for new data base applications. It &
is less complex than CONTACT.J but contains multiple keys, &
record locking and screen management functions needed by all &
data bases. For an even simpler example, see FILTER.J
Return (Ok)
MailList:Add(*Con) | Create a new record
| The key to creating a new record is to use the New function.
| The new function must be the first function used in a method.
| The new function is the only way in JORF to allocate memory
| and disk resources to create a new piece of data.
New (Contact:NewCon) | Create and new empty maillist structure
NewCon->FullName = "New Record" | Set a piece of data in it
Jorf:Write(NewCon) | Write it to the correct file
Con = NewCon | And reset "Con" to point to our new one.
Win:Dsp | Redisplay everything
Kbd:Put("Alt_C_Key") | Move the cursor to "Name"
Return(Ok)
MailList:Change() | Change the current Con record
Kbd:Put("Alt_C_Key") | stuff Alt_C to move the cursor to Name
Return(Ok) | That is all!
MailList:ContinLabels(Con,Flag)
New (Dest,Count,i)
Dest=Jorf:Printer()
If (Dest)
| Report format for Continuous labels, 6 lines per label, 1 line between
|
Rep:Add ("Continuous Labels")
Next:"MailList:Nextlabel(Con,Flag,Count)"
Item:"" NewRow:1 Col:26 Wid:12
Item:"Con->FullName" NewRow:1 Col:1 Wid:40
Item:"Con->Company" NewRow:1 Col:1 Wid:40
Before:"Con->Company!=Null"
Item:"Con->Addr1" NewRow:1 Col:1 Wid:40
Item:"Con->Addr2" NewRow:1 Col:1 Wid:40
Item:"Con->Addr3" NewRow:1 Col:1 Wid:40
Item:"" NewRow:1
Before:"Con->Company==Null"
| I like to append one blank label to advance the printer so I can
| tear off the label just printed.
For (i=1 Thru 5)
File:Append("JREPORT.LST")
| The Rep:Add function does not actually print, it just makes
| a report file called JREPORT.LST. We can print this file
| using the File:Print function.
File:Print("JREPORT.LST",Dest,TRUE)
Return(Ok)
MailList:Delete(Con) | Delete MailList Record
New (Result)
| Pop up a nice screen to ask if they are sure
Result=Msg:Add('MailList Delete','No')
Delete this contact?
Name: {Bold:5}{Str:Pad(Con->FullName,30)}{Bold:0}
Company: {Bold:5}{Str:Pad(Con->Company ,30)}{Bold:0}
Address : {Bold:5}{Str:Pad(Con->Addr1,30)}{Bold:0}
{Bold:5}{Str:Pad(Con->Addr2,30)}{Bold:0}
{Bold:5}{Str:Pad(Con->Addr3,30)}{Bold:0}
| If they said "Yes", then Result will equal Ok (1)
If (Result==Ok)
Jorf:Del(Con)
Win:Dsp
Return (Ok)
MailList:KeySearch (*Con, Field)
New (Value,Prompt)
Event:Add | Block "MailKey" Events so Alt-C won't work
Switch (Field)
Case ("FullName")
Prompt="Name"
Case ("Company")
Prompt="Company"
Case ("WorkPhone")
Prompt="Phone"
Case ("LastName")
Prompt="Last Name"
Case ("ZipCode")
Prompt="Zip Code"
Else
Msg:Add
Unknown Field {Field}
Return (Ok)
Win:Add ("Key Search", 10, 15, 6, 60, Here)
Input:"Search for {Prompt}", Row: 2 Col:5 Wid:30, Field:"Value"
Button:"&Search" Row:4 Col:5 Wid:20 Action:"Return (Null)"
B